import {
  IsOptional,
  IsString,
  IsNumber,
  IsEmail,
  IsBoolean,
} from 'class-validator';
import { Type } from 'class-transformer';

/**
 * 查询用户条件 DTO
 */
export class FindUserDto {
  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  id?: number;

  @IsOptional()
  @IsString()
  username?: string;

  @IsOptional()
  @IsEmail()
  email?: string;

  @IsOptional()
  @IsString()
  phone?: string;

  @IsOptional()
  @IsBoolean()
  @Type(() => Boolean)
  isActive?: boolean;

  @IsOptional()
  @IsString()
  keyword?: string; // 用于模糊搜索用户名或邮箱

  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  page?: number; // 页码

  @IsOptional()
  @IsNumber()
  @Type(() => Number)
  pageSize?: number; // 每页数量
}
